package gps;

import android.location.Location;
import android.location.LocationListener;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.Toast;
import ar.com.gastos.Gps_activity;
import ar.com.gastos.R;

public class GpsLocationListener implements LocationListener {

	Gps_activity contexto;

	EditText lat;
	EditText longi;

	public GpsLocationListener(Gps_activity gps_activity) {
		contexto = gps_activity;

		lat = (EditText) contexto.findViewById(R.id.latitud);
		longi = (EditText) contexto.findViewById(R.id.longitud);

	}

	
	public void onLocationChanged(Location loc) {

		String latitude = "Mis coordenadas son: " + "Latitud = "
				+ loc.getLatitude();
		String logitude = "Longitud = " + loc.getLongitude();

		lat.setText(latitude);
		longi.setText(logitude);

	}

	
	public void onProviderDisabled(String arg0) {
		Toast.makeText(contexto.getApplicationContext(), "no anda el gps",
				Toast.LENGTH_SHORT).show();

	}

	
	public void onProviderEnabled(String arg0) {
		Toast.makeText(contexto.getApplicationContext(), "Agarro el gps",
				Toast.LENGTH_SHORT).show();

	}

	
	public void onStatusChanged(String arg0, int arg1, Bundle arg2) {
		Toast.makeText(contexto.getApplicationContext(), "Cambio el estado",
				Toast.LENGTH_SHORT).show();

	}

}
